package com.drops.utils;

/**
 * @ClassName: StringRandom
 * @Description: TODO
 * @Author: Summer
 * @Date: 2022/4/17 19:43
 * @Version: v1.0.0
 * @Description:
 **/
public class StringRandom {

    /**
     * @Description: 获取随机字符串
     * @Param: [length]
     * @return: java.lang.String
     *
     */
    public static String getRandomString(int length) {
        String base = "abcdefghijklmnopqrstuvwxyz0123456789";
        int size = base.length();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < length; i++) {
            int number = (int) (Math.random() * size);
            sb.append(base.charAt(number));
        }
        return sb.toString();
    }

}
